﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Objects.DataClasses;

[assembly: global::System.Data.Objects.DataClasses.EdmSchemaAttribute()]
namespace WA.Core.DomainModel
{
    [EdmEntityType(Name = "Invoice", NamespaceName = "WA.Core.DomainModel")]
    public class Invoice : BaseEntity<int>
    {
        private string invoiceNumber;
        private int companyId;
        private int partnerId;
        private DateTime releaseDate;
        private int releaseYear;
        private decimal subTotal;
        private decimal vat;
        private decimal total;

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable = false)]
        public string InvoiceNumber
        {
            get { return invoiceNumber; }
            set
            {
                this.PropertyChanging("InvoiceNumber");
                invoiceNumber = value;
                this.PropertyChanged("InvoiceNumber");
            }

        }

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
        public int InvoiceID
        {
            get
            {
                return base.ID;

            }
            set
            {
                this.PropertyChanging("InvoiceID");
                base.ID = value;
                this.PropertyChanging("InvoiceID");
            }
        }

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable = false)]
        public DateTime ReleaseDate
        {
            get { return releaseDate; }
            set
            {
                this.PropertyChanging("ReleaseDate");
                releaseDate = value;
                this.PropertyChanged("ReleaseDate");
            }

        }

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable = false)]
        public int ReleaseYear
        {
            get { return releaseYear; }
            set
            {
                this.PropertyChanging("ReleaseYear");
                releaseYear = value;
                this.PropertyChanged("ReleaseYear");
            }

        }

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable = false)]
        public decimal SubTotal
        {
            get { return subTotal; }
            set
            {
                this.PropertyChanging("SubTotal");
                subTotal = value;
                this.PropertyChanged("SubTotal");
            }

        }

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable = false)]
        public decimal Vat
        {
            get { return vat; }
            set
            {
                this.PropertyChanging("Vat");
                vat = value;
                this.PropertyChanged("Vat");
            }

        }

        [global::System.Data.Objects.DataClasses.EdmScalarPropertyAttribute(IsNullable = false)]
        public decimal Total
        {
            get { return total; }
            set
            {
                this.PropertyChanging("Total");
                total = value;
                this.PropertyChanged("Total");
            }

        }


       [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("WA.Core.DomainModel", "CompanyInvoice", "Company")]
        public Company Company
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("WA.Core.DomainModel.CompanyInvoice", "Company").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("WA.Core.DomainModel.CompanyInvoice", "Company").Value = value;
            }
        }        

        public global::System.Data.Objects.DataClasses.EntityReference<Company> CompanyReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Company>("WA.Core.DomainModel.Company", "Company");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Company>("WA.Core.DomainModel.Company", "Company", value);
                }
            }
        }

        // parter reference


        [global::System.Data.Objects.DataClasses.EdmRelationshipNavigationPropertyAttribute("WA.Core.DomainModel", "PartnerInvoice", "Partner")]
        public Partner Partner
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Partner>("WA.Core.DomainModel.PartnerInvoice", "Partner").Value;
            }
            set
            {
                ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Partner>("WA.Core.DomainModel.PartnerInvoice", "Partner").Value = value;
            }
        }

        public global::System.Data.Objects.DataClasses.EntityReference<Partner> PartnerReference
        {
            get
            {
                return ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.GetRelatedReference<Partner>("WA.Core.DomainModel.Partner", "Partner");
            }
            set
            {
                if ((value != null))
                {
                    ((global::System.Data.Objects.DataClasses.IEntityWithRelationships)(this)).RelationshipManager.InitializeRelatedReference<Partner>("WA.Core.DomainModel.Partner", "Partner", value);
                }
            }
        }
        

        
    }
}
